<template>
	<view class="clientRFecord">
		<view class="clientRFecord-list" v-if="list.length > 0">
			<view class="clientRFecord-li" v-for="(item, index) of list" :key="index">
				<view class="clientRFecord-li-head" :class="[item.orderState == 4? 'clientRFecord-li-head-back2' : '']">
					<view class="clientRFecord-li-head-id">
						订单编号：{{item.id}}
					</view>
					<view class="clientRFecord-li-head-right font_blod" :class="[item.orderState == 4? 'clientRFecord-li-head-right-ok' : '']">
						{{item.orderState | changeorderState}}
					</view>
				</view>
				<view class="clientRFecord-li-bt">
					
				</view>
				<view class="clientRFecord-li-con">
					<view class="clientRFecord-li-con-left">
						收货人
					</view>
					<view class="clientRFecord-li-con-right font_blod">
						{{item.orderName}}
					</view>
				</view>
				
				<view class="clientRFecord-li-con">
					<view class="clientRFecord-li-con-left">
						联系方式
					</view>
					<view class="clientRFecord-li-con-right font_blod">
						{{item.orderPhone}}
					</view>
				</view>
				
				<view class="clientRFecord-li-con">
					<view class="clientRFecord-li-con-left">
						下单时间
					</view>
					<view class="clientRFecord-li-con-right font_blod">
						{{item.createTime}}
					</view>
				</view>
				<view class="">
					
				</view>
				<view class="clientRFecord-li-con flex-bet">
					<view class="flex">
						<view class="clientRFecord-li-con-left">
							合计金额
						</view>
						<view class="clientRFecord-li-con-right font_blod">
							￥{{item.orderEndMoney}}
						</view>
					</view>
					<view @click="cli_details(item, index)" class="clientRFecord-btn" :class="[item.orderState == 4? 'clientRFecord-btn-ok' : '']">
						查看详情
					</view>
				</view>
			</view>
		</view>
		<view v-else class="clientRFecord-listNo">
			<view class="clientRFecord-listNoBox">
				<image class="clientRFecord-listNoImg" src="https://www.zzzsyh.com/applets/agent/factory/22.png" mode=""></image>
				<view class="clientRFecord-listNoTxt">
					暂无发货记录～
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import allapi from '../api/index.js'
	export default {
		data() {
			return {
				factoryId: uni.getStorageSync('id_factory'),
				agentId: '',
				pageNum: 1,
				list: []
			}
		},
		onLoad(val) {
			this.agentId = val.id
		},
		mounted() {
			// 获取平台客户发货记录
			this.getPlatformUserOrderList()
		},
		methods: {
			// 点击查看详情
			cli_details (item, index) {
				let id = item.id
				uni.navigateTo({
					url: '/pages/manufacturers/clientRecordDetails/clientRecordDetails?id=' + id
				})
			},
			// 获取平台客户发货记录
			getPlatformUserOrderList () {
				uni.request({
					url: allapi.getPlatformUserOrderList,
					data: {
						factoryId: this.factoryId,
						agentId: this.agentId,
						pageNum: this.pageNum,
						pageSize: 10
					},success: (res) => {
						console.log(res);
						let dat = res.data.data
						this.list = dat
					}
				})
			}
		},
		filters: {
			changeorderState (val) {
				if (val == 1) {
					return '待接单'
				}else if (val == 2) {
					return '待发货'
				}else if (val == 3) {
					return '未付款'
				}else if (val == 4) {
					return '已付款'
				}
			}
		}
	}
</script>

<style scoped>
	.clientRFecord {
		
	}
	.clientRFecord-listNo {
		position: absolute;
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.clientRFecord-listNoImg {
		width: 362rpx;
		height: 320rpx;
	}
	.clientRFecord-listNoTxt {
		font-size: 28rpx;
		color: #999999;
		margin-top: 76rpx;
		text-align: center;
	}
	.clientRFecord-list {
		margin: 0 24rpx;
	}
	.clientRFecord-li {
		margin: 24rpx 0;
		/* padding: 24rpx; */
		/* padding-top: 0.1rpx; */
		padding-bottom: 24rpx;
		padding-right: 24rpx;
		border-radius: 16rpx;
		background: #FFFFFF;
	}
	.clientRFecord-li-head {
		/* padding-bottom: 20rpx; */
		height: 78rpx;
		line-height: 78rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #999999;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background: url('https://www.zzzsyh.com/applets/agent/factory/29.png');
		background-repeat: no-repeat;
		background-size: contain;
	}
	.clientRFecord-li-head-back2 {
		background: url('https://www.zzzsyh.com/applets/agent/factory/30.png');
		background-repeat: no-repeat;
		background-size: contain;
	}
	.clientRFecord-li-head-id {
		margin-left: 24rpx;
	}
	.clientRFecord-li-head-right {
		font-size: 28rpx;
		color: #6B7D88;
	}
	.clientRFecord-li-head-right-ok {
		color: #42C8EA;
	}
	.clientRFecord-li-bt {
		border-bottom: 1rpx solid #EEEEEE;
		margin-left: 24rpx;
	}
	.clientRFecord-li-con {
		display: flex;
		font-size: 28rpx;
		height: 54rpx;
		align-items: center;
		margin-left: 24rpx;
	}
	.clientRFecord-li-con-left {
		width: 120rpx;
		color: #666666;
		font-weight: 400;
	}
	.clientRFecord-li-con-right {
		color: #333333;
	}
	.clientRFecord-btn {
		width: 144rpx;
		height: 56rpx;
		background: #96A8B4;
		border-radius: 28rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-weight: 400;
		color: #FFFFFF;
	}
	.clientRFecord-btn-ok {
		background: #5DD4D6;
	}
	.flex {
		display: flex;
		align-items: center;
	}
	.flex-bet {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
</style>
